//
//  KColumnInfo.h
//  MengLiao
//
//  Created by xiuxin on 2022/7/15.
//  Copyright © 2022 ZHBen. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "KColumnCellView.h"

typedef NS_ENUM(NSUInteger, KDisplayPosition) {
    KDisplayNone,
    KDisplayTop,
    KDisplayFullScreen,
    KDisplayBottom,
};

@protocol KColumnContentView <NSObject>

- (UIScrollView *)scrollView;
@optional
- (void)viewWillAppear;

- (void)viewWillDisappear;

- (BOOL)disableOffsetChange;

@end

@class KColumnInfo;
@protocol KColumnListControl <NSObject>

- (__kindof UIScrollView *)containerView;

- (void)reloadColumn:(KColumnInfo *)column;

- (void)loadColumnList:(NSArray<KColumnInfo *> *)columnList;

- (void)columnInfo:(KColumnInfo *)column displayPositionChanged:(KDisplayPosition)position;

- (void)stopKVO;

@end

@interface KColumnInfo : NSObject

@property (weak,nonatomic) UIView * view;

@property (strong,nonatomic) UIView<KColumnContentView> * columnView;

@property (readonly,weak,nonatomic) __kindof UIView * cell;

@property (readonly,strong,nonatomic) UIScrollView * scroll;

@property (readonly,nonatomic) CGSize itemSize;

@property (weak,nonatomic) id<KColumnListControl> control;

@property (copy,nonatomic) NSString * spec;

@property (nonatomic) UIEdgeInsets displayInsets;

- (instancetype)initWithColumnView:(UIView<KColumnContentView> *)columnView;

- (BOOL)refreshItemSize;

- (void)containerOffsetChanged;

- (void)setScrollOffset:(CGPoint)offset;

- (void)cellWillDisplay:(__kindof UIView *)cell contentView:(UIView *)contentView;

- (void)cellDidEndDisplay:(__kindof UIView *)cell;

- (KDisplayPosition)displayPosition;

@end

